namespace org.jawk.jrt
{
	/// <summary>An item that blocks.</summary>
	/// <remarks>An item that blocks.</remarks>
	public interface IBlockable
	{
		/// <summary>Polls whether the item will block or not.</summary>
		/// <remarks>
		/// Polls whether the item will block or not.
		/// The blocking mechanism should perform this once.
		/// If blocking will occur, then the blocking mechanism
		/// will enter into a wait() state.  Otherwise,
		/// the item is in a non-blocking state, waiting to
		/// be processed by the client.
		/// </remarks>
		/// <param name="bo">The block object querying whether to block or not.</param>
		/// <returns>
		/// true if it will block (i.e., no data is
		/// available), false otherwise
		/// </returns>
		bool WillBlock(org.jawk.jrt.BlockObject bo);
	}

    public interface IJoinable : org.jawk.jrt.IBlockable
    {
        //////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////
        /// <exception cref="System.Exception"></exception>
        void Join();

        void Interrupt();
    }

    public interface ICloseable : org.jawk.jrt.IJoinable
    {
        bool IsClosed();

        /// <exception cref="System.IO.IOException"></exception>
        void Close();
    }

    public interface IConsumer : org.jawk.jrt.ICloseable
    {
        void Start();

        /// <exception cref="System.Exception"></exception>
        string GetInput();

        int Write(string buf);

        int Flush();
    }
}
